package model.inventory;
// Generated Oct 27, 2012 8:43:23 AM by Hibernate Tools 3.2.1.GA


import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import utility.typeSafe.SalesPriceType;

/**
 * MstItemPrice generated by hbm2java
 */
@Entity
@Table(name="mst_item_price",schema="inventory")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class ItemPrice  implements java.io.Serializable {

     private ItemPriceId id;
     private Item item;
     private Unit unit;
     private Integer fraksi;
     private BigDecimal margin;
     private BigDecimal markup;
     private BigDecimal price;
     private Boolean pkp;
     private String sumber;
     private BigDecimal hppAfterTax;
     private BigDecimal hppBeforeTax;
     private BigDecimal AvgAfterTax;
     private BigDecimal AvgBeforeTax;

    public ItemPrice() {
        this.id = new ItemPriceId(0, new Date(), 1);
        this.item = new Item();
        this.unit = new Unit();
        this.fraksi = 1;
        this.margin = new BigDecimal(0);
        this.price = new BigDecimal(0);
        this.markup = new BigDecimal(0);
        this.pkp = true;
        this.sumber = SalesPriceType.HPP.toString();
        this.hppAfterTax = new BigDecimal(0);
        this.hppBeforeTax = new BigDecimal(0);
        this.AvgAfterTax = new BigDecimal(0);
        this.AvgBeforeTax = new BigDecimal(0);
    }

    public ItemPrice(ItemPriceId id) {
        this.id = id;
        this.item = new Item();
        this.unit = new Unit();
        this.fraksi = 1;
        this.margin = new BigDecimal(0);
        this.price = new BigDecimal(0);
        this.markup = new BigDecimal(0);
        this.pkp = true;
        this.sumber = SalesPriceType.HPP.toString();
        this.hppAfterTax = new BigDecimal(0);
        this.hppBeforeTax = new BigDecimal(0);
        this.AvgAfterTax = new BigDecimal(0);
        this.AvgBeforeTax = new BigDecimal(0);
    }
	
    @EmbeddedId
    @AttributeOverrides( {
        @AttributeOverride(name="itemId", column=@Column(name="item_id", nullable=false) ), 
        @AttributeOverride(name="startDate", column=@Column(name="start_date", nullable=false, length=13) ), 
        @AttributeOverride(name="priceLevel", column=@Column(name="price_level", nullable=false) ) } )
    public ItemPriceId getId() {
        return this.id;
    }
    
    public void setId(ItemPriceId id) {
        this.id = id;
    }
    
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="item_id", nullable=false, insertable=false, updatable=false)
    public Item getItem() {
        return this.item;
    }
    
    public void setItem(Item item) {
        this.item = item;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="unit_id", nullable=false)
    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }
    
    @Column(name="fraksi")
    public Integer getFraksi() {
        return this.fraksi;
    }
    
    public void setFraksi(Integer fraksi) {
        this.fraksi = fraksi;
    }
    
    @Column(name="margin", precision=12)
    public BigDecimal getMargin() {
        return this.margin;
    }
    
    public void setMargin(BigDecimal margin) {
        this.margin = margin;
    }
    
    @Column(name="markup", precision=12)
    public BigDecimal getMarkup() {
        return this.markup;
    }
    
    public void setMarkup(BigDecimal markup) {
        this.markup = markup;
    }
    
    @Column(name="price", precision=12)
    public BigDecimal getPrice() {
        return this.price;
    }
    
    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Column(name="pkp")
    public Boolean isPkp() {
        return pkp;
    }
    
    public void setPkp(Boolean pkp) {
        this.pkp = pkp;
    }

    @Column(name="sumber")
    public String getSumber() {
        return sumber;
    }

    public void setSumber(String sumber) {
        this.sumber = sumber;
    }

    @Transient
    public BigDecimal getHppAfterTax() {
        return hppAfterTax;
    }

    public void setHppAfterTax(BigDecimal hppAfterTax) {
        this.hppAfterTax = hppAfterTax;
    }

    @Transient
    public BigDecimal getHppBeforeTax() {
        return hppBeforeTax;
    }

    public void setHppBeforeTax(BigDecimal hppBeforeTax) {
        this.hppBeforeTax = hppBeforeTax;
    }

    @Transient
    public BigDecimal getAvgAfterTax() {
        return AvgAfterTax;
    }

    public void setAvgAfterTax(BigDecimal AvgAfterTax) {
        this.AvgAfterTax = AvgAfterTax;
    }

    @Transient
    public BigDecimal getAvgBeforeTax() {
        return AvgBeforeTax;
    }

    public void setAvgBeforeTax(BigDecimal AvgBeforeTax) {
        this.AvgBeforeTax = AvgBeforeTax;
    }
    
    
    
    
    
    




}


